<style scoped lang="less">
  @import "My";
</style>
<template>
  <div class="container">
    <div class="top" v-if="data!=null">
      <!--      个人信息-->
      <div class="user-info-wrap">
        <van-image class="head-img" :src="data.head_img"></van-image>
        <span class="nick-name">{{data.nickname}}</span>
      </div>
    </div>
    <!--    推广信息-->
    <div class="card-wrap-inv">
      <div class="class-inv-title">我的推广</div>
      <div class="inv-wrap">
        <div class="inv-item">
          <div class="inv-item-detail"><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_my_yaoqing.png"></div>
          <div class="inv-item-title"> <router-link to="/spread/mydistribution">我的邀请</router-link></div>
        </div>
        <div class="line-v"></div>
        <div class="inv-item">
          <div class="inv-item-detail"><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_my_tuiguang.png"></div>
          <div class="inv-item-title"> <router-link to="/spread/myreward">我的推广</router-link></div>
        </div>
        <div class="line-v"></div>
        <div class="inv-item">

          <div class="inv-item-detail"><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_my_paihang.png"></div>
          <div class="inv-item-title"><router-link to="/spread/rank">排行榜</router-link></div>
        </div>
      </div>
    </div>
    <!--    其它信息-->
    <div class="other-info">

      <!--      钱包-->
      <div class="info-card money-wrap" v-if="incomeData!=null">
        <span class="money-title">我的钱包</span>
        <div class="money-item-wrap">
          <div class="money-item">
            <div class="money-item-num">{{incomeData.total_income/100}}</div>
            <div class="money-item-title">总收益</div>
          </div>
          <div class="money-item">
            <div class="money-item-num">{{incomeData.income_today/100}}</div>
            <div class="money-item-title">今日收益</div>
          </div>
          <div class="money-item" @click="toWithdrawals">
            <div class="money-item-num">{{incomeData.income/100}}</div>
            <div class="money-item-title">可提现</div>
          </div>
        </div>
      </div>
      <!--      订单-->
      <div class="info-card order-wrap">
        <div class="order-title-wrap">
          <span class="order-title">我的订单</span>
          <span class="order-all" @click="toOrderList(0)">查看订单 ></span>
        </div>
        <div class="order-item-wrap">
          <div class="order-item" @click="toOrderList(1)">
            <div class="order-item-icon"><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_daifukuan.png"></div>
            <div class="order-item-title">未付款</div>
          </div>
          <div class="order-item" @click="toOrderList(2)">
            <div class="order-item-icon" ><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_yifukuan.png"></div>
            <div class="order-item-title">待使用</div>
          </div>
          <div class="order-item" @click="toOrderList(3)">
            <div class="order-item-icon" ><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_shouhuo.png"></div>
            <div class="order-item-title">未收货</div>
          </div>
          <div class="order-item" @click="toOrderList(4)">
            <div class="order-item-icon"><img src="http://yqlife.oss-cn-hangzhou.aliyuncs.com/asset/icon/icon_daipingjia.png"></div>
            <div class="order-item-title">待评价</div>
          </div>
        </div>
      </div>
      <div class="info-card menu-wrap">
        <div class="item-menu" @click="toKjOrderList">

          <span class="item-menu-title">砍价订单</span>
          <span class="item-menu-title">></span>
        </div>
      </div>
    </div>
	  <div class="footer">
		  <span class="suggest" @click="toSuggest">意见反馈</span>
	  </div>
  </div>
</template>
<script>
  import {getUserInfo} from "@/api/user";
  import {getIncome} from "@/api/wallet";
  import Vue from 'vue';
  import {Image, Icon} from 'vant';

  Vue.use(Image).use(Icon);
  export default {
    name: 'my',
    data() {
      return {
        data: null,
        incomeData: null,
      };
    },
    created() {
      this.getData();
    },
    methods: {
      getData() {
        let vm = this;
        getUserInfo().then(rep => {
          vm.data = rep.data.data;
        });
        getIncome().then(rep=>{
          vm.incomeData = rep.data.data;
        })
      },
      toKjOrderList(type=0){
        this.$router.push({name: 'kj-order-list', params: {type: type}})
      },
      toOrderList(type = 0) {
        this.$router.push({name: 'order-list', params: {type: type}})
      },
      toSuggest(){
        this.$router.push({name:'suggest'});
      },
      toWithdrawals(){
        this.$router.push({name:'withdrawals'});
      }
    }
  }
</script>
